package com.stargis.ftpdown.scheduled;

import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class AutoConnService {

    //网络重连地址
    @Value(value = "${yjzx.connUrl}")
    private String connUrl;

    @Scheduled(cron = "${yjzx.connCron}")
    //@Async("taskExecutor")
    public void scheduled(){
        String  result = HttpUtil.get(connUrl);
        if(result.contains("auth_type=1")){
            System.out.println("网络连接成功！");
            log.info("{},网络连接成功！", DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss"));
        }
    }

}